#!/usr/bin/env python
# encoding: utf-8
"""
test_setup.py

Created by Manabu Terada on 2009-09-20.
Copyright (c) 2009 CMScom. All rights reserved.
"""
from Products.CMFCore.utils import getToolByName

import c2.site.icos09
import base

class TestInstall(base.IcosTestCase):
    """ Install basic test """ 
    def afterSetUp(self):
        pass

    def testQuickInstall(self):
        qi = self.portal.portal_quickinstaller
        self.failUnless('c2.site.icos09' in (p['id'] for p in qi.listInstallableProducts()))
        qi.installProduct('c2.site.icos09')
        self.failUnless(qi.isProductInstalled('c2.site.icos09'))
        self.failUnless(qi.isProductInstalled('webcouturier.dropdownmenu'))
    
class TestSkinInstall(base.IcosTestCase):
    """  """
    def afterSetUp(self):
        qi = self.portal.portal_quickinstaller
        qi.installProduct('c2.site.icos09')
        # qi.installProduct('webcouturier.dropdownmenu')

    def testSkinLayersInstalled(self):
        self.skins = self.portal.portal_skins
        # print self.skins.objectIds()
        self.failUnless('icos09' in self.skins.objectIds())
        self.assertEqual(len(self.skins.icos09.objectIds()), 8)
        
        self.failUnless('icos09_img' in self.skins.objectIds())
        self.assertEqual(len(self.skins.icos09_img.objectIds()), 0)

def test_suite():
    from unittest import TestSuite, makeSuite
    suite = TestSuite()
    suite.addTest(makeSuite(TestInstall))
    suite.addTest(makeSuite(TestSkinInstall))
    return suite
